package org.groupg.filetodb.model;

import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;

/**
 * 字段信息配置
 */
public class ColumnConfig {
    /**
     * 字段名称
     */
    private String tableName;
    /**
     * 字段名称
     */
    private String columnName;
    /**
     * 字段顺序
     */
    private Integer columnIndex;
    /**
     * 字段数据库说明
     */
    private String columnComment;
    /**
     * 字段说明
     */
    private String columnDescription;

    /**
     * 字段类型为日期或数字时的转化数据格式，由字符串转数字或转日期的格式
     */
    private String dateFormat;


    @Override
    public String toString() {
        return MoreObjects.toStringHelper(this)
                .add("tableName", tableName)
                .add("columnName", columnName)
                .add("columnIndex", columnIndex)
                .add("columnComment", columnComment)
                .add("columnDescription", columnDescription)
                .add("dateFormat", dateFormat)
                .toString();
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) return false;
        ColumnConfig that = (ColumnConfig) o;
        return Objects.equal(getTableName(), that.getTableName()) && Objects.equal(getColumnName(), that.getColumnName()) && Objects.equal(getColumnIndex(), that.getColumnIndex()) && Objects.equal(getColumnComment(), that.getColumnComment()) && Objects.equal(getColumnDescription(), that.getColumnDescription()) && Objects.equal(getDateFormat(), that.getDateFormat());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getTableName(), getColumnName(), getColumnIndex(), getColumnComment(), getColumnDescription(), getDateFormat());
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public String getColumnName() {
        return columnName;
    }

    public void setColumnName(String columnName) {
        this.columnName = columnName;
    }

    public Integer getColumnIndex() {
        return columnIndex;
    }

    public void setColumnIndex(Integer columnIndex) {
        this.columnIndex = columnIndex;
    }

    public String getColumnComment() {
        return columnComment;
    }

    public void setColumnComment(String columnComment) {
        this.columnComment = columnComment;
    }

    public String getColumnDescription() {
        return columnDescription;
    }

    public void setColumnDescription(String columnDescription) {
        this.columnDescription = columnDescription;
    }

    public String getDateFormat() {
        return dateFormat;
    }

    public void setDateFormat(String dateFormat) {
        this.dateFormat = dateFormat;
    }
}
